package myblog.action;

import myblog.service.UserService;
import myblog.vo.UsersVo;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {
	private String username;
	private String password;
	private UserService service;
	
	public String checkPussword() {
		System.out.println("username:"+username);
		System.out.println("userpass:"+password);
		if (username != null && password != null) {
			UsersVo user = service.getuserByName(username);
			if (user != null) {
				if (user.getUser_name().equals(username)
						&& user.getUser_pw().equals(password)) {
					return SUCCESS;
				}
			}
		}
		return "failure";
	}
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public UserService getService() {
		return service;
	}
	public void setService(UserService service) {
		this.service = service;
	}
	
}
